import java.math.BigInteger;
import java.util.Scanner;

public class FCTRLBigInteger {

	public static void main(String[] args) {

		// input number of testcases
		byte testcase;
		byte largestNum = 0;
		Scanner in = new Scanner(System.in);
		testcase = in.nextByte();

		// Check input number of testcase
		if (testcase < 1 || testcase > 100) {
			in.close();
			return;
		}

		// find the largest input number of the testcases
		byte numbers[] = new byte[testcase];
		for (int i = 0; i < testcase; i++) {
			numbers[i] = in.nextByte();
			if (numbers[i] < 1) {
				numbers[i] = 0;
			}
			if (numbers[i] > largestNum) {
				largestNum = numbers[i];
			}
		}

		// in.close();

		// Compute factorial of the largest number entered by the user
		BigInteger[] factNum = factorial(largestNum);

		// Print the factorial of all the testcases

		for (int i = 0; i < numbers.length; i++) {
			System.out.println(factNum[numbers[i]]);
		}

		in.close();
	}

	// compute the factorial of the largest number entered by the user from
	// which we can easily calculate the factorial of the smaller value than the
	// largest number
	public static BigInteger[] factorial(byte largestNum) {
		BigInteger largestFact[] = new BigInteger[largestNum + 1];
		largestFact[0] = BigInteger.ZERO;
		BigInteger factNum = null;
		for (int i = 1; i < largestFact.length; i++) {
			factNum = BigInteger.ONE;
			for (long j = 1; j <= i; j++) {
				factNum = factNum.multiply(BigInteger.valueOf(j));
			}
			largestFact[i] = factNum;

		}
		/*
		 * for (int i = 0; i <= largestNum; i++) {
		 * System.out.println(largestFact[i]); }
		 */

		return largestFact;
	}
}